home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / misc / emu / prlink_amiga.lha / prlink-0.8.0a / src / prsample.asm < prev    next >
Assembly Source File  |  1995-04-03  |  2KB  |  115 lines

  1. #processor 6502
  2. #include "options.inc"
  3.  
  4. #if target & c128
  5. host    = 128
  6. #endif
  7. #if target & c64
  8. host    = 64
  9. #endif
  10. #if target & vic20
  11. host    = 20
  12. #endif
  13.  
  14. #if target & (c64 | c128)
  15. #org $2000    ;; C64 and C128
  16. ackval    = 4
  17. ack    = $dd00
  18. data    = $dd01
  19. ddr    = $dd03
  20. strobe    = $dd0d
  21. sample    = $d418
  22. #endif
  23.  
  24. #if target & vic20
  25. #org $2000    ;; Vic-20
  26. ackval    = $20
  27. ack    = $911c
  28. data    = $9110
  29. ddr    = $9112
  30. strobe    = $911d
  31. sample    = $900e
  32. #endif
  33.  
  34. #if target & (pet3001 | pet4001)
  35. #org $2000    ;; This does not actually work.
  36. ackval    = 0
  37. ack    = 0
  38. data    = 0
  39. ddr    = 0
  40. strobe    = 0
  41. sample    = 0
  42. #endif
  43.  
  44.   sei
  45. #if target & c128
  46.   lda #$3e
  47.   sta $ff00
  48. #endif
  49. #if (cable & (prlink | pc64)) * (target & vic20)
  50.   lda #$ef
  51.   and ack
  52.   sta ack    ; set CB1 to trigger on falling edge
  53. #endif
  54.  
  55. loop:
  56. #if cable & prlink
  57.   lda #$10
  58. 0$:
  59.   bit strobe    ; wait for handshaking
  60.   beq 0$
  61. #if target & vic20
  62.   sta strobe
  63. #endif
  64.   lda #ackval
  65.   eor ack
  66.   ldx data      ; read the byte
  67.   sta ack       ; acknowledge
  68.   txa
  69. #endif
  70.  
  71. #if cable & pc64
  72.   lda #$10
  73. 0$:
  74.   bit strobe    ; wait for handshaking
  75.   beq 0$
  76. #if target & vic20
  77.   sta strobe
  78. #endif
  79.   lda ack
  80.   tax
  81.   and #255 - ackval
  82.   sta ack
  83.   lda #$10
  84. 1$:
  85.   bit strobe
  86.   beq 1$
  87. #if target & vic20
  88.   sta strobe
  89. #endif
  90.   lda data
  91.   stx ack
  92. #endif
  93.  
  94. #if cable & c64net
  95.   lda #8
  96. 0$:
  97.   bit data    ; initial handshaking
  98.   beq 0$
  99.   ldx data    ; get the high nybble
  100.   sta data    ; acknowledge (place 0 on PB2)
  101. 1$:
  102.   bit data    ; wait for acknowledgement
  103.   bne 1$
  104.   lda #4
  105.   sta data    ; acknowledge
  106.   txa
  107. #endif
  108.  
  109.   lsr
  110.   lsr
  111.   lsr
  112.   lsr
  113.   sta sample
  114.   jmp loop
  115.